-module(shop2).
-export([total/1, totalcompre/1]).
-import(mylists, [map/2, sum/1]).
total(Buy) ->
	%mylists:sum(mylists:map(fun({Name, N})-> shop:cost(Name) * N end, Buy)).
	sum(map(fun({Name, N})-> shop:cost(Name) * N end, Buy)).

totalcompre(Buy) ->
	sum([shop:cost(Name) * N || {Name, N} <- Buy]).
	
